class ApplicationController < ActionController::Base
  protect_from_forgery
  
  before_filter :check_db
  before_filter :check_configuration
  
  # Verify that the system has been configured.  If not, feed them to the configurator  
  def check_configuration
    if Setting.find_by_key('configured') != true
      redirect_to :controller => "admin", :action => "setup"
    end
  end
  
  # Verify that the system database is properly operating
  def check_db
    begin
      Setting.new
    rescue ActiveRecord::StatementInvalid
      redirect_to :controller => "admin", :action => "setup_db"
    end  
  end
  
end
